public function execute( $par ) {
global $wgUser, $wgOut, $wgRequest;
- # Can't block when the database is locked
- if( wfReadOnly() ) {
- $wgOut->readOnlyPage();
- return;
- }
# Permission check
if( !$this->userCanExecute( $wgUser ) ) {
- $wgOut->permissionRequired( 'block' );
+ $this->displayRestrictionError();
return;
}
+ # Can't block when the database is locked
+ if( wfReadOnly() ) {
+ throw new ReadOnlyError;
+ }
+
# Extract variables from the request. Try not to get into a situation where we
# need to extract *every* variable from the form just for processing here, but
# there are legitimate uses for some variables
$this->setHeaders();
- if( !$wgUser->isAllowed( 'siteadmin' ) ) {
- $wgOut->permissionRequired( 'siteadmin' );
+ # Permission check
+ if( !$this->userCanExecute( $wgUser ) ) {
+ $this->displayRestrictionError();
return;
}
global $wgUser, $wgOut, $wgRequest;
# Check permissions
- if( !$wgUser->isAllowed( 'block' ) ) {
- $wgOut->permissionRequired( 'block' );
+ if( !$this->userCanExecute( $wgUser ) ) {
+ $this->displayRestrictionError();
return;
}
+
# Check for database lock
if( wfReadOnly() ) {
- $wgOut->readOnlyPage();
+ throw new ReadOnlyError;
return;
}
}
public function execute( $par ) {
- global $wgUser, $wgOut, $wgRequest;
+ global $wgUser, $wgRequest;
$this->setHeaders();
- if( !$wgUser->isAllowed( 'siteadmin' ) ) {
- $wgOut->permissionRequired( 'siteadmin' );
+ # Permission check
+ if( !$this->userCanExecute( $wgUser ) ) {
+ $this->displayRestrictionError();
return;
}